﻿<UserControl x:Class="MainGameModule.Views.ImageObjectView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:local="clr-namespace:MainGameModule.Views"
             xmlns:converters="clr-namespace:MainGameModule.Views.Converters">
    <UserControl.Resources>
        <converters:BoolToOpacityConverter x:Key="BoolToOpacityConverter"/>
    </UserControl.Resources>
    
    <Image x:Name="objectImage"   
           Width="{Binding Width}"
           Height="{Binding Height}"
           Stretch="Uniform"
           Opacity="{Binding IsEnabled, Converter={StaticResource BoolToOpacityConverter}}"
           RenderTransformOrigin="0.5,0.5">

        <Image.RenderTransform>
            <ScaleTransform ScaleY="-1"/>
        </Image.RenderTransform>

    </Image>

    <ToolTipService.ToolTip>
        <ToolTip Width="300"  x:Name="toolTip">
            <ToolTip.Template>
                <ControlTemplate TargetType="ToolTip">
                    <Border>
                        
                        <Grid Margin="3">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

	<Rectangle Grid.RowSpan="2" RadiusX="7" RadiusY="7">
		<Rectangle.Effect>
			<DropShadowEffect Opacity="0.6"/>
		</Rectangle.Effect>
		<Rectangle.Fill>
			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFD1E778"/>
                                <GradientStop Color="#FF4A6305" Offset="0.692"/>
                                <GradientStop Color="#FF869D38" Offset="0.088"/>
                            </LinearGradientBrush>
		</Rectangle.Fill>
	</Rectangle>

                            <ContentPresenter Margin="10" Content="{TemplateBinding Content}"/>
                            <Line X2="10"
                                  Grid.Row="1"
                                  Stretch="Fill"
                                  StrokeThickness="2" 
                                  StrokeDashCap="Round"
                                  Stroke="Yellow" 
                                  Margin="10,0,10,10"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </ToolTip.Template>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image x:Name="toolTipImage" 
                       Width="60" 
                       Height="60"/>
                <TextBlock Text="{Binding Description}" FontFamily="Segoa UI" Foreground="White"
                           Margin="10,0,0,0" 
                           TextWrapping="Wrap"
                           Grid.Column="1"/>
            </Grid>
        </ToolTip>
    </ToolTipService.ToolTip>

</UserControl>
